/**
 * Class representing a Player for an FPS game.
 * Extend for your game if necessary.
 * 
 * @author Paul Redert
 * 
 * author: Paul Redert
 * license: GPLV3
 * 
 * GoldenAK Bot - code.google.com/p/goldenak-bot
 * 
 */
package eu.goldenak.ircbot.game;

import java.util.Vector;

public class Player {
		
	/**
	 * The Globally Unique Identifier for this player.
	 */
	private String guid;
	
	/**
	 * The current id of the player on the server.
	 */
	private int id;
	
	/**
	 * The name of this player.
	 */
	private String name;

	/**
	 * The name of the team this player is on.
	 */
	private String teamname;
	
	/**
	 * The ping of this player.
	 */
	private int ping;
	
	/**
	 * The sore of this player.
	 */
	private int score;
	
	/**
	 * The kills of this player.
	 */
	private Vector<Kill> kills;

	/**
	 * The deaths of this player.
	 */
	private Vector<Kill> deaths;
	
	/**
	 * The current killstreak of this player.
	 */
	public int currentKillstreak;
	
	/**
	 * The biggest killstreak of this player.
	 */
	public int biggestKillstreak;
	
	/**
	 * The current deathstreak of this player.
	 */
	public int currentDeathstreak;

	/**
	 * The biggest deathstreak of this player.
	 */
	public int biggestDeathstreak;
		
	/**
	 * Default constructor.
	 * @param guid the Globally Unique Identifier of this player
	 */
	public Player(int id, String guid) {
		this.id = id;
		this.guid = guid;
	}
	
	/**
	 * Returns the Globally Unique Identifier of this player.
	 * @return the Globally Unique Identifier of this player
	 */
	public String getGUID() {
		return guid;
	}	
	
	/**
	 * Returns the name of this player.
	 * @return the name of this player
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * Returns the teamname of this player. 
	 * @return the teamname of this player
	 */
	public String getTeamname(){
		return teamname;
	}
	
	/**
	 * Set the ping of this player. (Update once in a while to keep accurate)
	 * @param ping the ping of this player
	 */
	public void setPing(int ping) {
		this.ping = ping;
	}

	/**
	 * Returns the ping of this plater
	 * @return the ping of this player
	 */
	public int getPing() {
		return ping;
	}

	/**
	 * Add a kill to this player. 
	 * @param k the kill to add
	 */
	public void addKill(Kill k){
		
		if(currentDeathstreak > biggestDeathstreak){
			biggestDeathstreak = currentDeathstreak;
		}
		currentDeathstreak = 0;
		currentKillstreak++;
		kills.add(k);
	}
	
	/**
	 * Add a death to this player.
	 * @param k the death to add
	 */
	public void addDeath(Kill k){
		if(currentKillstreak > biggestKillstreak){
			biggestKillstreak = currentKillstreak;
		}
		currentKillstreak = 0;
		currentDeathstreak++;
		deaths.add(k);
	}

	/**
	 * Add points to the score of this player.
	 */
	public void addScore(int score){
		this.score += score;
	}

	/**
	 * The id of this player on the server.
	 * @return the id of this player
	 */
	public int getID() {
		return id;
	}
	
}